import { CoolController, BaseController } from '@cool-midway/core';
import { TaskAppEntity } from '../../entity/app';
import { TaskAppService } from '../../service/app';
import { Body, Inject, Post } from '@midwayjs/core';

/**
 * 应用管理
 */
@CoolController({
  api: ['add', 'delete', 'update', 'info', 'list', 'page'],
  entity: TaskAppEntity,
  service: TaskAppService,
  pageQueryOp: {
    keyWordLikeFields: ['name'],
  },
})
export class AdminTaskAppController extends BaseController {
  @Inject()
  taskAppService: TaskAppService;

  @Post('/reset', { summary: '重置' })
  async reset(@Body('id') id: number) {
    await this.taskAppService.reset(id);
    return this.ok();
  }
}
